import { Table, Form, Space, Button, Popconfirm } from "antd";
import { CommonTable } from "@/pages/OrderModule/common/components/CommonTable";
const TableEditForm = props => {
	console.log(props, "props");
	return (
		<Form.List name={props.name}>
			{(fields, { add, remove }) => {
				const dataSource = props.form.getFieldValue("goodsSku");
				return (
					<CommonTable
						dataSource={dataSource}
						pagination={false}
						scroll={props.scroll}
						bordered={props?.bordered}
						columns={[
							...props.columns,
							{
								title: "操作",
								dataIndex: "opera",
								fixed: "right",
								width: 80,
								render(_, record, index) {
									return (
										<>
											<Space>
												<Popconfirm
													title="确定删除吗？"
													okText="确定"
													cancelText="取消"
													onConfirm={() => props.remove(record, index)}
												>
													<Button type="link">删除</Button>
												</Popconfirm>
											</Space>
										</>
									);
								}
							}
						]}
					/>
				);
			}}
		</Form.List>
	);
};
export default TableEditForm;
